<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    	<link rel="stylesheet" type="text/css"
			href="<%=basePath%>common/ui/jquery-easyui-1.3.0/themes/default/easyui.css">
		<link rel="stylesheet" type="text/css"
			href="<%=basePath%>common/ui/jquery-easyui-1.3.0/themes/icon.css">
		<script type="text/javascript"
			src="<%=basePath%>common/ui/jquery-easyui-1.3.0/jquery-1.7.2.min.js"></script>
		<script type="text/javascript"
			src="<%=basePath%>common/ui/jquery-easyui-1.3.0/jquery.easyui.min.js"></script>
		<script type="text/javascript"
			src="<%=basePath%>common/ui/jquery-easyui-1.3.0/locale/easyui-lang-zh_CN.js"></script>
			
		<link rel="stylesheet" href="<%=basePath%>common/kindeditor-4.1.7/themes/default/default.css" />
		<script src="<%=basePath%>common/kindeditor-4.1.7/kindeditor.js"></script>
		<script src="<%=basePath%>common/kindeditor-4.1.7/lang/zh_CN.js"></script>
		
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.STYLE1 {font-size: 12px}
.STYLE3 {font-size: 12px; font-weight: bold; }
.STYLE4 {
	color: #03515d;
	font-size: 12px;
}
-->
</style>
<SCRIPT type="text/javascript">
KindEditor.ready(function(K) {
	var editor = K.editor({
		cssPath : '<%=basePath%>common/kindeditor-4.1.7/plugins/code/prettify.css',
		uploadJson : '<%=basePath%>common/kindeditor-4.1.7/jsp/upload_json.jsp',
		fileManagerJson : '<%=basePath%>common/kindeditor-4.1.7/jsp/file_manager_json.jsp',
		allowFileManager : true,
	});
	K('#upload_picture_button').click(function() {
		editor.loadPlugin('image', function() {
			editor.plugin.imageDialog({
				imageUrl : K('#productNormal.imageUrl').val(),
				clickFn : function(url, title, width, height, border, align) {
					K('#productNormal_imageUrl').val(url);
					var localImagId = document.getElementById("headImageView");
                    localImagId.src=url;
					editor.hideDialog();
				}
			});
		});
	});
});

  function saveData() {
        $('#infoForm').form('submit', {
            url:'<%=basePath%>manage/admin/product!editSave.action?productType=${productType}',
            onSubmit: function () {
                return $(this).form('validate');
            },
            success: function (data) {
                //alert(data);
                eval('data=' + data);
                if (data.success) {
                    history.back();
                } else {
                    $.messager.alert('错误', data.msg, 'error');
                }
            }
        });
    }

</SCRIPT>
  </head>
    <body class="easyui-layout" style="overflow:auto;">
		<div data-options="region:'center',title:'产品信息编辑'" >
		    <div style="padding:5px;background:#fafafa;width:100%;">
		      <a href="javascript:history.back();" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-undo'" >返回</a>
		      <a href="javascript:saveData();" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-save'"> 保存</a>
	       </div>
	       <div style="padding:5px;width:100%; height:100%">
	    <s:form id="infoForm"  method="post" theme="simple" >
		   <s:hidden name="productNormal.beanId"/>
		   <s:hidden name="productNormal.imageUrl" id="productNormal_imageUrl"/>
		  <table width="98%" border="0" cellpadding="0" cellspacing="1" bgcolor="b5d6e6" onmouseover="changeto()"  onmouseout="changeback()">
           <tr>          
            <td height="30" width="100px" bgcolor="#FFFFFF"><div align="right"><span class="STYLE1">图片浏览</span></div></td>
             <td height="30" bgcolor="#FFFFFF"><div align="left"><p>
               <img id="headImageView"   src="${productNormal.imageUrl}" alt="" width="100px" height="100px"/>
               <input type="button" name="upload_picture_button" id="upload_picture_button" value="上传图片"/></p></div>
            </td>
            </tr>
		    <tr>          
            <td height="30" bgcolor="#FFFFFF"><div align="right"><span class="STYLE1">产品名称</span></div></td>
            <td height="30" bgcolor="#FFFFFF"><div align="left"><span class="STYLE1"><s:textfield name="productNormal.infoTitle"/></span> <s:fielderror cssStyle="color:red;font-size: 12px"><s:param>loginNameError</s:param></s:fielderror></div></td>
           </tr>
            <tr>          
            <td height="30" bgcolor="#FFFFFF"><div align="right"><span class="STYLE1">产品路径</span></div></td>
            <td height="30" bgcolor="#FFFFFF"><div align="left"><span class="STYLE1"><s:textfield name="productNormal.absoluteUrl"/></span> <s:fielderror cssStyle="color:red;font-size: 12px"><s:param>loginNameError</s:param></s:fielderror></div></td>
           </tr>
            <tr>          
            <td height="30" bgcolor="#FFFFFF"><div align="right"><span class="STYLE1">产品价格</span></div></td>
            <td height="30" bgcolor="#FFFFFF"><div align="left"><span class="STYLE1"><s:textfield name="productNormal.infoPrice"/>(数字 如：100.00)</span> <s:fielderror cssStyle="color:red;font-size: 12px"><s:param>loginNameError</s:param></s:fielderror></div></td>
           </tr>
            <tr>          
            <td height="30" bgcolor="#FFFFFF"><div align="right"><span class="STYLE1">产品来源</span></div></td>
            <td height="30" bgcolor="#FFFFFF"><div align="left"><span class="STYLE1"><s:textfield name="productNormal.infoSource"/></span> <s:fielderror cssStyle="color:red;font-size: 12px"><s:param>loginNameError</s:param></s:fielderror></div></td>
           </tr>
           <tr>          
            <td height="30" bgcolor="#FFFFFF"><div align="right"><span class="STYLE1">所属分类</span></div></td>
            <td height="30" bgcolor="#FFFFFF"><div align="left"><span class="STYLE1">
                                 <select class="easyui-combotree" data-options="url:'<%=basePath%>manage/admin/product_categories!dataListSelectd.action&selectedId=${productNormal.categorie.beanId}',required:true,cascadeCheck:false" 
									name="categorie" style="width: 300px;" />
									</span> <s:fielderror cssStyle="color:red;font-size: 12px"><s:param>loginNameError</s:param></s:fielderror></div></td>
           </tr>
           <tr>          
            <td height="30" bgcolor="#FFFFFF"><div align="right"><span class="STYLE1">所属品牌</span></div></td>
            <td height="30" bgcolor="#FFFFFF"><div align="left"><span class="STYLE1"><s:textfield /></span> <s:fielderror cssStyle="color:red;font-size: 12px"><s:param>loginNameError</s:param></s:fielderror></div></td>
           </tr>
            </table>
          </s:form>
	       </div>
		</div>
	</body>
</html>
